<?php

namespace IMT\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="groupcontact")
 */
class GroupContact
{
    /**
    * @ORM\Id
    * @ORM\Column(type="integer")
    * @ORM\generatedValue(strategy="AUTO")
    */
    private $id;
    
    /**
     * @var string $title
     *
     * @ORM\Column(name="title", type="string", length=255)
     */
    private $title;
    
    /**
     * @ORM\ManyToMany(targetEntity="IMT\UserBundle\Entity\Contact", mappedBy="groups", cascade={"persist", "update"})
     */
    private $contacts;
    
    /**
     * @ORM\ManyToOne(targetEntity="IMT\UserBundle\Entity\User", inversedBy="groupsContact")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     */
    private $user;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
    
    /**
     * Constructor
     */
    public function __construct()
    {
    	$this->contacts = new \Doctrine\Common\Collections\ArrayCollection();
        $this->users = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Add contacts
     *
     * @param IMT\UserBundle\Entity\Contact $contact
     */
    public function addContact(\IMT\UserBundle\Entity\Contact $contact)
    {
    	$this->contacts[] = $contact;
    }
    
    /**
     * Get contacts
     *
     * @return Doctrine\Common\Collections\Collection
     */
    public function getContacts()
    {
    	return $this->contacts;
    }
    
    /**
     * Set user
     *
     * @param IMT\UserBundle\Entity\User $user
     */
    public function setUser(\IMT\UserBundle\Entity\User $user)
    {
        $this->user = $user;
    }

    /**
     * Get user
     *
     * @return IMT\UserBundle\Entity\User 
     */
    public function getUser()
    {
        return $this->user;
    }

    
    /**
     * Set title
     *
     * @param string $title
     */
    public function setTitle($title)
    {
        $this->title = $title;
    }

    /**
     * Get title
     *
     * @return string 
     */
    public function getTitle()
    {
        return $this->title;
    }
}